Skip to content

🤖 fix: rank slash suggestions by match quality (exact > prefix > segment) - #3920

Open
asm wants to merge 1 commit into
coder:mainfrom
asm:slash-suggestion-ranking
Open

🤖 fix: rank slash suggestions by match quality (exact > prefix > segment)#3920
asm wants to merge 1 commit into
coder:mainfrom
asm:slash-suggestion-ranking

Conversation

@asm

@asm asm commented Aug 21, 2026

Copy link
Copy Markdown

Summary

With skills named lint, lint-fix, and auto-lint, typing /lint in the composer suggested auto-lint above the exact-match lint. The segment-prefix matcher legitimately matches all three ("lint".startsWith("lint") on auto-lint's second segment — that's the feature that lets /proc find data-processing-style names), but the suggestion builders were pure .filter() passes with no ranking, so results kept discovery order — which is alphabetical, and a < l.

Suggestions now rank by match quality: exact name → whole-name prefix → segment prefix, with a stable sort so items within a tier keep their original order and a bare / still lists everything unchanged. /lint now suggests lint, then lint-fix, then auto-lint.

Implementation

  • suggestionMatching.ts gains rankNameMatch (the tiers, null for no match) and filterAndRankByNameMatch (filter + stable rank sort in one place). matchesNameBySegmentPrefix is reimplemented on top of rankNameMatch so the boolean and ranking views cannot drift.
  • All suggestion surfaces route through the shared helper: built-in slash commands, skills, plugin commands, MCP prompts, model aliases, subcommand completion, and inline $skill references (inlineSkillSuggestions.ts). The ghost hint improves automatically since it derives from the first suggestion.
  • Section grouping is intentionally unchanged (commands → skills → plugins → prompts → aliases); ranking applies within each section.

Validation

  • New tests: tier ordering and case/trim semantics for rankNameMatch; stable within-tier ordering for filterAndRankByNameMatch; end-to-end getSlashCommandSuggestions("/lint") ordering (lintlint-fixauto-lint) plus a bare-/ discovery-order regression guard.
  • Full bun test src/browser/utils (1413 tests across 87 files) green; typecheck, eslint, prettier clean.

🤖 Generated with Claude Code

@asm

asm commented Aug 21, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: c27434bfd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: c27434bfd6

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Typing "/lint" with skills named lint, lint-fix, and auto-lint listed
auto-lint first: the segment-prefix matcher legitimately matches all
three, but suggestions kept discovery (alphabetical) order with no
ranking. Matches now sort by tier — exact name, then whole-name prefix,
then segment prefix — with the stable sort preserving discovery order
within a tier and a bare "/" listing everything unchanged. Applies to
slash commands, skills, plugin commands, MCP prompts, model aliases,
subcommands, and inline $skill references via one shared helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@asm
asm force-pushed the slash-suggestion-ranking branch from c27434b to 7f2cab9 Compare August 21, 2026 22:05
@asm

asm commented Aug 21, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 7f2cab932b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7f2cab932b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant